package optimization.ifelse.op_before;

import optimization.ifelse.DbTypeEnum;
import optimization.ifelse.db_driver.*;

public class Test_op_before {

    /*
    * 未优化
    * */
    public static void main(String[] args) {
        String type="hbase";
        if (type.equals(DbTypeEnum.MYSQL_DRIVER.type())){
            MySQL mySQL=new MySQL();
            mySQL.getConnect();
            mySQL.excute();
            mySQL.disconnect();
        }else if (type.equals(DbTypeEnum.HBASE_DRIVER.type())){
            Hbase hbase=new Hbase();
            hbase.getConnect();
            hbase.excute();
            hbase.disconnect();
        }else if (type.equals(DbTypeEnum.MONGO_DRIVER.type())){
            Mongo mongo=new Mongo();
            mongo.getConnect();
            mongo.excute();
            mongo.disconnect();
        }else if (type.equals(DbTypeEnum.ORCAL_DRIVER.type())){
            Orcal orcal=new Orcal();
            orcal.getConnect();
            orcal.excute();
            orcal.disconnect();
        }else if (type.equals(DbTypeEnum.SQLSERVER_DRIVER.type())){
            SqlServer sqlServer=new SqlServer();
            sqlServer.getConnect();
            sqlServer.excute();
            sqlServer.disconnect();
        }else{
            System.out.println("did not have this database");
        }//逻辑异常 可以提前
    }
}
